package cn.edu.controller;

import cn.edu.domain.*;
import cn.edu.service.dep_TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Davey chan
 */
@RestController
@RequestMapping("/dep_Teacher")
public class dep_TeacherController {
    @Autowired
    private dep_TeacherService teacherService;
    //分页查询
    @PostMapping("/{currentPage}/{pageSize}")
    public Result selectByPage(@PathVariable Integer currentPage,
                               @PathVariable Integer pageSize,
                               @RequestBody All t){
        PageBean<All> pageBean = teacherService.selectByPageAndcondition(currentPage, pageSize,t);
        return new Result(Code.GET_OK,pageBean);
    }
    /*删除教师*/
    @DeleteMapping("/{id}")
    public Result delteacher(@PathVariable Integer id) {

        teacherService.delteacher(id);
        return new Result(Code.DELETE_OK,"ok");
    }
    @RequestMapping("/Teach_work")
    public Result UpdateTeach_work(@RequestBody teach_work t){
        teacherService.Updateteach_work(t);
      return  new Result(Code.UPDATE_OK,"ok");
    }
    @RequestMapping("/Annual_examination")
    public Result UpdateAnnual_examination(@RequestBody annual_examination t){
        teacherService.UpdateAnnual_examination(t);
        return  new Result(Code.UPDATE_OK,"ok");
    }

    @RequestMapping("/Patent")
    public Result UpdatePatent(@RequestBody patent t){
        teacherService.UpdatePatent(t);
        return  new Result(Code.UPDATE_OK,"ok");
    }

    @RequestMapping("/Opus")
    public Result UpdateOpus(@RequestBody opus t){
        teacherService.UpdateOpus(t);
        return  new Result(Code.UPDATE_OK,"ok");
    }
    @RequestMapping("/Thesis")
    public Result UpdateThesis(@RequestBody thesis t){
        teacherService.UpdateThesis(t);
        return  new Result(Code.UPDATE_OK,"ok");
    }

    @RequestMapping("/Honor")
    public Result UpdateHonor(@RequestBody honor_title t){
        teacherService.UpdateHonor(t);
        return  new Result(Code.UPDATE_OK,"ok");
    }
    @RequestMapping("/Train")
    public Result UpdateTrain(@RequestBody train t){
        teacherService.UpdateTrain(t);
        return  new Result(Code.UPDATE_OK,"ok");
    }

    @RequestMapping("/Work")
    public Result UpdateWork(@RequestBody work t){
        teacherService.UpdateWork(t);
        return  new Result(Code.UPDATE_OK,"ok");
    }
    @RequestMapping("/Award")
    public Result UpdateAward(@RequestBody award t){
        teacherService.UpdateAward(t);
        return  new Result(Code.UPDATE_OK,"ok");
    }
    @RequestMapping("/Research_project")
    public Result UpdateResearch_project(@RequestBody research_project t){
        teacherService.UpdateResearch_project(t);
        return  new Result(Code.UPDATE_OK,"ok");
    }

}
